<?php
//session_start();
require('config.inc.php');
header("Content-type:text/html;charset=utf-8");

//SQL更新
$id = $_GET['id'];
mysql_query("set names utf8");

//提交
if(isset($_POST['submit'])){
	echo $username;
	$username = $_POST['username'];
	$content = $_POST['content'];
	$sql = "UPDATE `info` SET `name` =  $username,`content` = $content";
	$result = mysql_query($sql);
	if($result){
		echo "<script>alert('更新成功');location.href='index.php';</script>";
	}
}


//更新
$sql1 = "SELECT * FROM `info` where `id` = $id";
$result1 = mysql_query($sql1);
$row = mysql_fetch_array($result1);



?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>留言编辑页面</title>
<script type="text/javascript" src="check.js"></script>
<link rel="stylesheet" type="text/css" href="style.css" />

</head>
<body>
	<h1>留言编辑</h1>
	<hr />
	<form action="#" method="post">
	<label for="username">用户名：</label><input type="text" id="username" name="username" value="<?php echo $row['name']; ?>" /><br />
	<label>验证码：</label><br />
	<label>提交部门：</label><select><option >1</option><option>2<option></select><Br />
	<label>留言内容:</label><br />
	<textarea rows="10" cols="50" name="content"><?php echo $row['content']; ?></textarea><br />
	<input type="submit" value="提交" name="submit" /><input type="reset" value="重置" />
	</form>
</body>
</html>

